home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gimp.idb / usr / freeware / catman / p_man / cat3 / gpc.Z / gpc
Encoding:
Text File  |  1999-07-21  |  10.8 KB  |  331 lines

  1.  
  2.  
  3.  
  4.      ggggppppcccc((((3333))))           RRRRooooaaaaddddkkkkiiiillllllllssss----RRRR----UUUUssss ((((33330000 AAAApppprrrr 1111999999998888))))        ggggppppcccc((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       GPC -    GTK Plug-in Convenience    library
  10.  
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.       #include <plug-ins/gpc/gpc.h>
  14.  
  15.  
  16.       void gpc_setup_tooltips(GtkWidget *parent);
  17.  
  18.       Initialize tooltips interface, set colors.
  19.  
  20.       void gpc_set_tooltip(GtkWidget *widget, const    char *tip);
  21.  
  22.       Set tooltip for a widget (if tip is non-null).
  23.  
  24.  
  25.       void gpc_add_action_button(char *label,
  26.           GtkSignalFunc callback, GtkWidget    *dialog, char *tip);
  27.  
  28.       Add action button (with tooltip) to a    dialog.
  29.  
  30.       void gpc_add_radio_button(GSList **group, char *label,
  31.           GtkWidget    *box, gint *value, char    *tip);
  32.  
  33.       Add radio button (with tooltip) to a dialog.
  34.  
  35.       void gpc_add_hscale(GtkWidget    *table,    int width,
  36.           float low, float high, gdouble *val,
  37.           int left,    int right, int top, int    bottom,    char *tip);
  38.  
  39.       Add horizontal scale widget (with tooltip) to    a dialog at
  40.       given    location.
  41.  
  42.       void gpc_add_label(char *value, GtkWidget *parent,
  43.           int left,    int right, int top, int    bottom);
  44.  
  45.       Add label widget (no tooltip)    to a dialog at given location.
  46.  
  47.  
  48.       void gpc_close_callback(GtkWidget *widget, gpointer data);
  49.  
  50.       Destroy callback - quit this plug-in.
  51.  
  52.       void gpc_cancel_callback(GtkWidget *widget, gpointer data);
  53.  
  54.       Cancel button    callback - go away without saving state, etc.
  55.  
  56.       void gpc_scale_update(GtkAdjustment *adjustment, double *scale_val);
  57.  
  58.       Scale    update callback    - update the SCALE widget's data.
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                         (printed 7/16/99)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      ggggppppcccc((((3333))))           RRRRooooaaaaddddkkkkiiiillllllllssss----RRRR----UUUUssss ((((33330000 AAAApppprrrr 1111999999998888))))        ggggppppcccc((((3333))))
  71.  
  72.  
  73.  
  74.       void gpc_text_update(GtkWidget *widget, gpointer data);
  75.  
  76.       Text update callback - update    the TEXT widget's data.
  77.  
  78.  
  79.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  80.       This is a set    of routines to make life easier    on plug-in
  81.       writers.  It helps keep the GUI code short and sweet.    (In
  82.       the plug-in for which    it was originally designed, it cut the
  83.       GUI code in half.)  It's somewhat arbitrary in what it
  84.       includes so far, because I haven't needed everything in GTK.
  85.       Feel free to contribute more to it.
  86.  
  87.  
  88.     TTTTOOOOOOOOLLLLTTTTIIIIPPPPSSSS RRRROOOOUUUUTTTTIIIINNNNEEEESSSS
  89.       ggggppppcccc____sssseeeettttuuuupppp____ttttoooooooollllttttiiiippppssss(((()))) must be called first.  This initializes
  90.       internal data    structures and sets the    tooltip    colors.     It
  91.       can be called    with any widget    high enough in the hierarchy
  92.       to contain all the widgets needing tooltips.    Typically this
  93.       will be the container    widget under the top-level frame:
  94.  
  95.       Example:
  96.           frame = gtk_frame_new("Parameter Settings");
  97.           :
  98.           gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox),
  99.           frame, TRUE, TRUE, 0);
  100.           table = gtk_table_new(4, 2, FALSE);
  101.           :
  102.           gtk_widget_show(table);
  103.           gpc_setup_tooltips(table);
  104.  
  105.  
  106.       ggggppppcccc____sssseeeetttt____ttttoooooooollllttttiiiipppp(((()))) may    be called directly, but    is usually
  107.       called inside    other convenience functions.  If called
  108.       directly, it must still be after the call to
  109.       gpc_setup_tooltips().     It hides a lot    of detail of the GTK
  110.       tooltips:
  111.  
  112.       Example:
  113.           gtk_widget_show(button);
  114.           gpc_set_tooltip(button, tip);
  115.  
  116.  
  117.  
  118.  
  119.     UUUUSSSSEEEERRRR IIIINNNNTTTTEEEERRRRFFFFAAAACCCCEEEE RRRROOOOUUUUTTTTIIIINNNNEEEESSSS
  120.       These    routines all hide implementation details to make it
  121.       easier to lay    out a GUI with a consitent, gimp-style
  122.       interface, while keeping the plug-in code cleaner.
  123.  
  124.  
  125.       ggggppppcccc____aaaadddddddd____aaaaccccttttiiiioooonnnn____bbbbuuuuttttttttoooonnnn(((()))) adds an action button    (such as
  126.  
  127.  
  128.  
  129.      Page 2                         (printed 7/16/99)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      ggggppppcccc((((3333))))           RRRRooooaaaaddddkkkkiiiillllllllssss----RRRR----UUUUssss ((((33330000 AAAApppprrrr 1111999999998888))))        ggggppppcccc((((3333))))
  137.  
  138.  
  139.  
  140.       [Cancel] or [OK] to the action button    area of    a frame.  The
  141.       _c_a_l_l_b_a_c_k argument has    the standard GTK callback interface.
  142.       A standard callback is provided for [Cancel] buttons if you
  143.       wish to use it.
  144.  
  145.  
  146.       Usage:
  147.           void
  148.           gpc_add_action_button(
  149.           char *label,          /* text for action button */
  150.           GtkSignalFunc    callback, /* callback function address */
  151.           GtkWidget *dialog,      /* dialog widget to contain button */
  152.           char *tip          /* tooltip text */
  153.           )
  154.  
  155.       Example:
  156.           static void
  157.           randomize_ok_callback(GtkWidget *widget, gpointer    data) {
  158.           rndm_int.run = TRUE;
  159.           gtk_widget_destroy(GTK_WIDGET(data));
  160.           }
  161.           :
  162.           gpc_add_action_button("OK",
  163.           (GtkSignalFunc) randomize_ok_callback, dlg,
  164.           "Accept settings and apply filter to image");
  165.           gpc_add_action_button("Cancel",
  166.           (GtkSignalFunc) gpc_cancel_callback, dlg,
  167.           "Close plug-in without making    any changes");
  168.  
  169.  
  170.       ggggppppcccc____aaaadddddddd____rrrraaaaddddiiiioooo____bbbbuuuuttttttttoooonnnn(((()))) adds a    radio button.  If the radio
  171.       group    does not exist,    it will    be created and passed back in
  172.       the _g_r_o_u_p argument.  A standard callback will    be attached to
  173.       the radio button, requiring a    state variable which you
  174.       provide via the _v_a_l_u_e    argument.
  175.  
  176.       Usage:
  177.           void
  178.           gpc_add_radio_button(
  179.           GSList **group,      /* address of    radio group */
  180.           char *label,          /* label for new radio button    */
  181.           GtkWidget *box,      /* radio box for this    radio button */
  182.           gint *value,          /* address of    state variable */
  183.           char *tip          /* tooltip text */
  184.           )
  185.  
  186.       Example:
  187.           GSList *type_group = NULL;
  188.           :
  189.           gpc_add_label("Randomization Type:", table, 0, 1,    0, 1);
  190.  
  191.           toggle_hbox = gtk_hbox_new(FALSE,    5);
  192.  
  193.  
  194.  
  195.      Page 3                         (printed 7/16/99)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      ggggppppcccc((((3333))))           RRRRooooaaaaddddkkkkiiiillllllllssss----RRRR----UUUUssss ((((33330000 AAAApppprrrr 1111999999998888))))        ggggppppcccc((((3333))))
  203.  
  204.  
  205.  
  206.           gtk_container_border_width(GTK_CONTAINER(toggle_hbox), 5);
  207.           gtk_table_attach(GTK_TABLE(table), toggle_hbox, 1, 2, 0, 1,
  208.           GTK_FILL | GTK_EXPAND, GTK_FILL, 5, 0);
  209.  
  210.           gpc_add_radio_button(&type_group,
  211.           "Hurl", toggle_hbox, &do_hurl,
  212.           "Hurl    random colors onto pixels");
  213.           gpc_add_radio_button(&type_group,
  214.           "Pick", toggle_hbox, &do_pick,
  215.           "Pick    at random from neighboring pixels");
  216.           gpc_add_radio_button(&type_group,
  217.           "Slur", toggle_hbox, &do_slur,
  218.           "Simplistic melt");
  219.  
  220.  
  221.  
  222.       ggggppppcccc____aaaadddddddd____hhhhssssccccaaaalllleeee(((()))) adds    a horizontal scale to a    table
  223.       container at the designated coordinates.  A standard
  224.       callback will    be attached to the scale, requiring a state
  225.       variable which you provide via the _v_a_l_u_e argument.
  226.  
  227.       Usage:
  228.           void
  229.           gpc_add_hscale(
  230.           GtkWidget *table,      /* table widget to hold scale    */
  231.           int width,          /* width (in pixels) of scale    */
  232.           float    low,          /* low value for scale */
  233.           float    high,          /* high value    for scale */
  234.           gdouble *value,      /* pointer to    current    value */
  235.           int left,          /* left table    position info */
  236.           int right,          /* right table position info */
  237.           int top,          /* top table position    info */
  238.           int bottom,          /* bottom table position info    */
  239.           char *tip          /* tooltip text */
  240.           )
  241.  
  242.       Example:
  243.           gpc_add_label("Randomization %:",    table, 0, 1, 2,    3);
  244.           gpc_add_hscale(table, SCALE_WIDTH,
  245.           1.0, 100.0, &pivals.rndm_pct,    1, 2, 2, 3,
  246.           "Percentage of pixels    to be filtered");
  247.  
  248.  
  249.       ggggppppcccc____aaaadddddddd____llllaaaabbbbeeeellll(((()))) simply adds a    label at the designated
  250.       coordinates in the table.  Labels don't get tooltips.
  251.  
  252.       Usage:
  253.           void
  254.           gpc_add_label(
  255.           char *value,          /* text for new label    */
  256.           GtkWidget *table,      /* table widget to hold label    */
  257.           int left,          /* left table    position info */
  258.  
  259.  
  260.  
  261.      Page 4                         (printed 7/16/99)
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      ggggppppcccc((((3333))))           RRRRooooaaaaddddkkkkiiiillllllllssss----RRRR----UUUUssss ((((33330000 AAAApppprrrr 1111999999998888))))        ggggppppcccc((((3333))))
  269.  
  270.  
  271.  
  272.           int right,          /* right table position info */
  273.           int top,          /* top table position    info */
  274.           int bottom          /* bottom table position info    */
  275.           )
  276.  
  277.       Example:
  278.           gpc_add_label("Randomization %:",    table, 0, 1, 2,    3);
  279.  
  280.  
  281.     CCCCAAAALLLLLLLLBBBBAAAACCCCKKKKSSSS::::
  282.       ggggppppcccc____cccclllloooosssseeee____ccccaaaallllllllbbbbaaaacccckkkk(((()))) is used in OK callbacks,    and anywhere
  283.       else you need    a callback to destroy widgets.    The default
  284.       cancel callback, ggggppppcccc____ccccaaaannnncccceeeellll____ccccaaaallllllllbbbbaaaacccckkkk(((()))) simply    closes
  285.       (destroys) the current panel.     The ggggppppcccc____ssssccccaaaalllleeee____uuuuppppddddaaaatttteeee(((())))    and
  286.       ggggppppcccc____tttteeeexxxxtttt____uuuuppppddddaaaatttteeee(((()))) callbacks update the appropriate widget's
  287.       data from that widget.
  288.  
  289.  
  290.       No special diagnostics are provided.
  291.  
  292.  
  293.      BBBBUUUUGGGGSSSS
  294.       This software    should be 100% Bug-Free    [tm].
  295.  
  296.  
  297.      AAAAUUUUTTTTHHHHOOOORRRR
  298.       Miles    O'Neal
  299.       <meo@rru.com>
  300.       http://www.rru.com/~meo/
  301.       Leander, TX
  302.       Additionally,    some of    the code may have been distilled from
  303.       the following    plug-ins:  _a_l_i_e_n_m_a_p (Copyright (C) 1996, 1997
  304.       Daniel Cotting) _p_l_a_s_m_a (Copyright (C)    1996 Stephen Norris),
  305.       _o_i_l_i_f_y (Copyright (C)    1996 Torsten Martinsen), _r_i_p_p_l_e
  306.       (Copyright (C) 1997 Brian Degenhardt)    and _w_h_i_r_l (Copyright
  307.       (C) 1997 Federico Mena Quintero).
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.      Page 5                         (printed 7/16/99)
  328.  
  329.  
  330.  
  331.